From: Keir Fraser Date: Wed, 10 Dec 2008 13:41:34 +0000 (+0000) Subject: Initialize state_entry_time to zero for all idle vcpus X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14026^2~44 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7132ae7e553f5dead2cb246165490ad4155ee83b;p=xen.git Initialize state_entry_time to zero for all idle vcpus NOW() is not usable since xen time sub-system hasn't been initialized yet. On my box, it gives a initial stamp ~60s due to local tsc stamp as zero and TSC count is started from power on. Then a negative value is added to runstate of that idle vcpu at schedule point. The net effect is for some tool like xenpm to show a big idle time gap between BSP and other APs. Signed-off-by: Kevin Tian Signed-off-by: Keir Fraser --- diff --git a/xen/common/domain.c b/xen/common/domain.c index 8c97a2b3a8..a48033cfc7 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -144,13 +144,16 @@ struct vcpu *alloc_vcpu( v->domain = d; v->vcpu_id = vcpu_id; - v->runstate.state = is_idle_vcpu(v) ? RUNSTATE_running : RUNSTATE_offline; - v->runstate.state_entry_time = NOW(); - spin_lock_init(&v->virq_lock); - if ( !is_idle_domain(d) ) + if ( is_idle_domain(d) ) + { + v->runstate.state = RUNSTATE_running; + } + else { + v->runstate.state = RUNSTATE_offline; + v->runstate.state_entry_time = NOW(); set_bit(_VPF_down, &v->pause_flags); v->vcpu_info = (void *)&shared_info(d, vcpu_info[vcpu_id]); }